#include<stdio.h>

#define N 8

int main()
{

int a[N] = {3, 21, 0, -3, 34, -14, 45, 18};
int b[N] = {0};
int  max, temp;
int i,j,p;
  for( i=0;i<N;i++)
  {
     b[i]=a[i];
  }

  for(i=0;i<N-1;i++)
  {
     max = b[i];
     for(j=i;j<N;j++)
     {
        if(b[j] > max)
       {
         max = b[j];
         p = j;
       }
     }
     temp = b[i];
     b[i] = max;
     b[p] = temp;
  }
  for( i=0;i<N;i++)
  {
     printf(" %d  ", b[i]);
  }
  printf(" \n\r");
  return 0;
}